﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using OgilvyOne.BLL;
using OgilvyOne.Model;

public partial class admin_infomation_info_map_list : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Grid_viewBild();
        }
    }
    //添加按钮
    protected void Add_click(object sender, EventArgs e)
    {
        this.PopedomValidate(Request.Params["layerid"], ADD);
        Response.Redirect("info_map_detail.aspx?aid=" + Request.Params["aid"] + "&layerid=" + Request.Params["layerid"], true);
    }
    //修改按钮
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridView gv = (GridView)sender;
        int mid = int.Parse(gv.DataKeys[e.RowIndex].Value.ToString());
        this.PopedomValidate(Request.Params["layerid"], MOD);
        Response.Redirect("info_map_detail.aspx?aid=" + Request.Params["aid"] + "&layerid=" + Request.Params["layerid"] + "&mid=" + mid);
    }
    //删除按钮
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        GridView gv = (GridView)sender;
        int mid = int.Parse(gv.DataKeys[e.RowIndex].Value.ToString());
        bool bl = new CmsArticleMapBll().Delete(mid);
        if (bl == true)
        {
            Response.Write("<script>alert('删除成功!')</script>");
            Grid_viewBild();
        }
        else
        {
            Response.Write("<script>alert('删除失败!')</script>");
        }
    }
    //绑定方法
    private void Grid_viewBild()
    {
        int aid = int.Parse(Request.Params["aid"]);
        CmsArticleModel cm = new CmsArticleBll().GetCmsArticleModel(aid);
        this.headers.Text = "当前位置：" + cm.Title + "&nbsp;&nbsp;<img src='../images/subnav_dot.gif' />&nbsp;&nbsp;相关地图";
        //CmsArticleMapModel map = new CmsArticleMapModel();
        IList datalist = new CmsArticleMapBll().GetMapList("  ARTICLE_ID = " + aid);
        GridView1.DataSource = datalist;
        GridView1.AllowPaging = false;
        GridView1.DataBind();
    }
}
